<template>
  <div v-if="showCard" class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>组织机构与职能</span>
        <!-- <el-button style="float: right; padding: 3px 0" type="text">评分</el-button> -->
        <el-select
          style="float: right; padding: 3px 0; width: 10%"
          size="small"
          v-model="form.type"
          placeholder="请选择评分"
        >
          <el-option label="1" value="1" />
          <el-option label="2" value="2" />
          <el-option label="3" value="3" />
          <el-option label="4" value="4" />
          <el-option label="5" value="5" />
        </el-select>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.purpose" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>学生社团章程</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.mean" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>评审学年社团工作总结</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.content" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>评审学年与社团性质相关的集体荣誉和会员荣誉</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.expect" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>评审学年工作计划</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.expect" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>杭州电子科技大学学生社团指导教师知情同意书</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.expect" :config="editorConfig"></ckeditor>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px">
      <div slot="header" class="clearfix">
        <span style="color: red">* </span><span>学生第一负责人评审学年两学期成绩单</span>
      </div>
      <!-- <ckeditor :editor-url="editorUrl"   v-model="form.purpose" :config="editorConfig"></ckeditor> -->
      <ckeditor v-model="form.expect" :config="editorConfig"></ckeditor>
    </el-card>
    <el-button style="margin: 20px 0; float: right" type="primary" @click="handleAdd"
      >提交</el-button
    >
    <!-- v-hasPermi="['eqxm:teamTeacher:add']" -->
  </div>
</template>

<script>
import CommonUtils from '@/utils/CommonUtils';
import CKEditor from 'ckeditor4-vue';
import { listTeamResearch, addTeamResearch, updateTeamResearch } from '@/api/eqxm/teamResearch';
import { getTeam } from '@/api/eqxm/team';
import { mapGetters } from 'vuex';

export default {
  name: 'TeamTeacher',
  components: {
    ckeditor: CKEditor.component,
  },
  computed: {
    ...mapGetters(['name', 'userName']),
  },
//   props: ['id'],
  data() {
    return {
      // 遮罩层
      loading: true,
      stuloading: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        teamid: null,
        name: null,
        college: null,
        username: null,
        outlook: null,
        tel: null,
        isheel: null,
      },
      // 表单参数
      form: {},
      id:"",
      // 表单校验
      rules: {},
      teamId: '',
      editorConfig: {
        readOnly: false,
        // The configuration of the editor.
      },
      editorConfig0: {
        readOnly: true,
        // The configuration of the editor.
      },
      editorConfig1: {
        readOnly: true,
        // The configuration of the editor.
      },
      editorConfig2: {
        readOnly: true,
        // The configuration of the editor.
      },
      editorConfig3: {
        readOnly: true,
        // The configuration of the editor.
      },
      showCard: false,
      //editorUrl: 'https://cdn.ckeditor.com/4.16.0/full/ckeditor.js'
      purpose: '',
    };
  },
  created() {
      this.id = this.$route.query.id;
      this.getList();
    // const teamId = CommonUtils.getCurTeamInfo().id;
    // this.teamId=teamId;
    console.log(this.id, 'id');
    this.editorConfig.readOnly = false;
    this.showCard = true;
    // getTeam(this.id).then(response => {
    //   console.log(response.data.createBy == this.name, '3eeee');
    //   var status =
    //     response.data.status == 0 || response.data.status == 2 || response.data.status == 3;
    //   if (this.isAdmin || (response.data.createBy == this.name && status)) {
    //     this.editorConfig0.readOnly = false;
    //     this.editorConfig1.readOnly = false;
    //     this.editorConfig2.readOnly = false;
    //     this.editorConfig3.readOnly = false;
    //   }
    //   this.showCard = true;
    // });
  },
  methods: {
    getList() {
      const teamId = CommonUtils.getCurTeamInfo().id;
      this.teamId = teamId;
      this.queryParams.teamid = teamId;
      listTeamResearch(this.queryParams).then(response => {
        console.log(response);
        if (response.rows.length > 0) {
          //   this.form = response.rows[0];
        }
      });
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.form.teamid = this.teamId;
      this.$confirm('是否确认提交年审材料?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(function () {
          //   return delExamined(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess('操作成功');
        });
      if (this.form.id != null) {
        // updateTeamResearch(this.form).then(response => {
        //   if (response.code === 200) {
        //   // this.$modal.msgSuccess("修改成功");
        //   this.getList();
        // }
        // });
      }
    },
  },
};
</script>
